function info = GetDICOMInfo(DarisID,handles)
%% GetDICOMInfo Retreive dicom header information in dataset. 
%
%  DarisID string containing DaRIS dataset ID 
%
%   - Michael Eager,  (michael.eager@monash.edu)


%     Copyright © 2012-2013 Michael Eager <michael.eager@monash.edu> 
%
%     This file is part of Xglom.
% 
%     This is free software: you can redistribute it and/or modify
%     it under the terms of the GNU General Public License as published by
%     the Free Software Foundation, either version 3 of the License, or
%     (at your option) any later version.
% 
%     This is distributed in the hope that it will be useful,
%     but WITHOUT ANY WARRANTY; without even the implied warranty of
%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%     GNU General Public License for more details.
% 
%     You should have received a copy of the GNU General Public License
%     along with this program.  If not, see <http://www.gnu.org/licenses/>.

% Check for dataset in Cache
imgvol=[];
currentFolder = pwd;
addpath(fullfile(currentFolder,'plugins','dicom_toolbox_version_2e'));

if nargin < 2
    disp(['GetDICOMInfo suggests two arguments. Assuming local ' ...
          'datasets are stored in directory ''Cache'' ']);
    CacheDir = fullfile(currentFolder,'Cache');
else
    CacheDir = handles.LocalCache
end

if ~isdir(fullfile(CacheDir,DarisID)) && ~exist(fullfile(CacheDir,DarisID,'0001.dcm'),'file')

     GetDICOMImage(DarisID); 
end

    if ~isdir(fullfile(CacheDir,DarisID)) && ~exist(fullfile(CacheDir,DarisID,'0001.dcm'),'file')

        warndlg('GetDICOMInfo unable to detect DICOM file.', 'Xglom Warning','modal');
        end
% Dicom is in local directory
    display 'Dataset in Cache. Reading info.'
    info = dicom_read_header(fullfile(CacheDir,DarisID,'0001.dcm'));    
end

        
